package com.cskaoyan.controller.wx;

import com.cskaoyan.model.admin.vo.BaseData;
import com.cskaoyan.model.admin.vo.BaseRespVo;
import com.cskaoyan.model.admin.vo.BaseRespVoNB;
import com.cskaoyan.model.vx.bo.WxFootPrintBo;
import com.cskaoyan.service.wx.WxFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @description:
 * @author: 牛犇
 * @date 2021/12/2 15:55
 */
@RequestMapping("/wx/footprint")
@RestController
public class WxFootprintController {
    @Autowired
    WxFootprintService wxFootprintService;

    @RequestMapping("list")
    public BaseRespVo list(Integer page, Integer limit, HttpSession session){
        Integer userId = (Integer) session.getAttribute("wxUserId");
        if(userId==null){
            return BaseRespVo.fail(500,"没有登录");
        }
        BaseData data=wxFootprintService.selectFootprintList(page,limit,userId);
        return  BaseRespVo.ok(data);
    }
    @RequestMapping("delete")
    public BaseRespVoNB delete(@RequestBody WxFootPrintBo wxFootPrintBo){
        wxFootprintService.delete(wxFootPrintBo.getId());
        return BaseRespVoNB.ok();
    }




}
